﻿<!--#INCLUDE FILE="config.asp"-->
<%
if(Session("SalesAccessLevel") <> 1 and Session("SalesAccessLevel") <> 4 ) then
	Response.Redirect("default.asp?msg=invalid")
end if

'Endcrypt information of CC
Set objEncrypter = Server.CreateObject ("Hyeongryeol.StringEncrypter")
objEncrypter.Key = edCode
objEncrypter.InitialVector = conIV

encryptNombreCard = objEncrypter.Encrypt(Request("NombreCard"))
encryptTipo = objEncrypter.Encrypt(Request("Tipo"))
encryptNumerodeTarjetaCard = objEncrypter.Encrypt(Request("NumerodeTarjetaCard"))
encryptCodigodeSeguridad = objEncrypter.Encrypt(Request("CodigodeSeguridad"))

' Add record to Trip Details
If (Request("travelID_new") <> "") then
	Creator = Request("Creator")
	Product = Request("Product")
	Campaign = Request("Campaign")
	Extra_Guests = Request("Extra_Guests")
	Extra_Nights = Request("Extra_Nights")
	Kids = Request("Kids")
	Extra_Names = Request("Extra_Names")
	Room_Details = Request("Room_Details")
	Activities = Request("Activities")
	arrival1 = Request("arrival1")
	departure1 = Request("departure1")
	arrival2 = Request("arrival2")
	departure2 = Request("departure2")
	pCode = "PSP"&Year(DATE())
else
	Creator = " "
	Product = 1
	Campaign = " "
	Extra_Guests = 0
	Extra_Nights = 0
	Kids = 0
	Extra_Names = " "
	Room_Details = " "
	Activities = " "
	arrival1 = " "
	departure1 = " "
	arrival2 = " "
	departure2 = " "
	pCode = ""
end if
	
' Extra 1
	Creator_Extra1 = Request("Creator_divB")
	Product_Extra1 = Request("Product_divB")
	Campaign_Extra1 = Request("Campaign_divB")
	Extra_Guests_Extra1 = Request("Extra_Guests_divB")
	Extra_Nights_Extra1 = Request("Extra_Nights_divB")
	Kids_Extra1 = Request("Kids_divB")
	Extra_Names_Extra1 = Request("Extra_Names_divB")
	Room_Details_Extra1 = Request("Room_Details_divB")
	Activities_Extra1 = Request("Activities_divB")
	arrival1_Extra1 = Request("arrival1_divB")
	departure1_Extra1 = Request("departure1_divB")
	arrival2_Extra1 = Request("arrival2_divB")
	departure2_Extra1 = Request("departure2_divB")
	
' Extra 2
	Creator_Extra2 = Request("Creator_divC")
	Product_Extra2 = Request("Product_divC")
	Campaign_Extra2 = Request("Campaign_divC")
	Extra_Guests_Extra2 = Request("Extra_Guests_divC")
	Extra_Nights_Extra2 = Request("Extra_Nights_divC")
	Kids_Extra2 = Request("Kids_divC")
	Extra_Names_Extra2 = Request("Extra_Names_divC")
	Room_Details_Extra2 = Request("Room_Details_divC")
	Activities_Extra2 = Request("Activities_divC")
	arrival1_Extra2 = Request("arrival1_divC")
	departure1_Extra2 = Request("departure1_divC")
	arrival2_Extra2 = Request("arrival2_divC")
	departure2_Extra2 = Request("departure2_divC")
	
' Extra 3
	Creator_Extra3 = Request("Creator_divD")
	Product_Extra3 = Request("Product_divD")
	Campaign_Extra3 = Request("Campaign_divD")
	Extra_Guests_Extra3 = Request("Extra_Guests_divD")
	Extra_Nights_Extra3 = Request("Extra_Nights_divD")
	Kids_Extra3 = Request("Kids_divD")
	Extra_Names_Extra3 = Request("Extra_Names_divD")
	Room_Details_Extra3 = Request("Room_Details_divD")
	Activities_Extra3 = Request("Activities_divD")
	arrival1_Extra3 = Request("arrival1_divD")
	departure1_Extra3 = Request("departure1_divD")
	arrival2_Extra3 = Request("arrival2_divD")
	departure2_Extra3 = Request("departure2_divD")
	
' Add record to Transport
	Aereopuerto = Request("Aereopuerto")
	Aereolinea = Request("Aereolinea")
	Need_Transport = Request("Need_Transport")
	Aprox_Arrival_Time = Request("Aprox_Arrival_Time")
	Notes = Request("Notes")
	Pending_info = Request("Pending_info")

' Them record vao Guests
	Title = Request("Title") 
	Fname = Request("Fname")
	Mname = Request("Mname")
	Lname = Request("Lname")
	phone = Request("phone")
	email = Request("email")
	language = Request("language")
	Address1 = Request("Address1")
	Address2 = Request("Address2")
	City = Request("City")
	Stado = Request("Stado")
	Zip = Request("Zip")
	Pais = Request("Pais")
	Communication = Request("Communication")
	Source = Request("Source")
	
	Assign = Request("AssignTo")
	if (Assign = "") then
		Assign = session("SalesId")
	end if
	
' Add record to Visit calendar
	Propiedad = Request("Property")
	if (Propiedad = "") then
		Propiedad = ""
	end if
	if (Propiedad = "VM" or Propiedad = "LC" or Propiedad = "Las Colinas" ) then
		Internest = "Full"
	elseif (Propiedad = "Residence Club") then
		Internest = "Fractional"
	else
		Internest = " "
	end if
	
	Give_Aways = Request("GiveAways")
	if (Give_Aways = "") then
		Give_Aways = ""
	end if
	Fecha = Request("Date_VisitCalendar")
	if (Fecha = "") then
		Fecha = ""
	end if
		hourday = Request("hour")
	minutesday = Request("minutes")
	timeday = Request("timeday")
	Hora_Time = hourday &"-"& minutesday & "-" &timeday
' End Visit Calendar
	
	set objConnect = server.createObject("ADODB.Connection")       
		objConnect.open conStr
		
	Set oCmd = Server.CreateObject("ADODB.Command")
		  
		    oCmd.ActiveConnection = objConnect
			oCmd.CommandText = "sp_edit_Prospect" 
			oCmd.CommandType = 4
			
			' ****************
			' Guests Parameters
			' ****************
			Set p_Title = oCmd.CreateParameter("@title", 200,1,100,Title)
			oCmd.Parameters.Append p_Title
			
			Set p_Fname = oCmd.CreateParameter("@Fname", 200,1,100,Fname)
			oCmd.Parameters.Append p_Fname
			
			Set p_Mname = oCmd.CreateParameter("@middle", 200,1,100,Mname)
			oCmd.Parameters.Append p_Mname
			
			Set p_Lname = oCmd.CreateParameter("@surname", 200,1,100,Lname)
			oCmd.Parameters.Append p_Lname
			
			Set p_Telefono = oCmd.CreateParameter("@phone", 200,1,100,phone)
			oCmd.Parameters.Append p_Telefono
			
			Set p_email = oCmd.CreateParameter("@email", 200,1,100,email)
			oCmd.Parameters.Append p_email
			
			Set p_language = oCmd.CreateParameter("@languageID", 3,1,100,language)
			oCmd.Parameters.Append p_language
			
			Set p_Address1 = oCmd.CreateParameter("@address1", 200,1,100,Address1)
			oCmd.Parameters.Append p_Address1
			
			Set p_Address2 = oCmd.CreateParameter("@address2", 200,1,100,Address2)
			oCmd.Parameters.Append p_Address2
			
			Set p_City = oCmd.CreateParameter("@city", 200,1,100,City)
			oCmd.Parameters.Append p_City
			
			Set p_Stado = oCmd.CreateParameter("@province", 200,1,100,Stado)
			oCmd.Parameters.Append p_Stado
			
			Set p_Zip = oCmd.CreateParameter("@zip", 200,1,100,Zip)
			oCmd.Parameters.Append p_Zip
			
			Set p_Pais = oCmd.CreateParameter("@country", 200,1,100,Pais)
			oCmd.Parameters.Append p_Pais
			
			Set p_Communication = oCmd.CreateParameter("@communication", 200,1,100,Communication)
			oCmd.Parameters.Append p_Communication
			
			Set p_Source = oCmd.CreateParameter("@Source", 200,1,100,Source)
			oCmd.Parameters.Append p_Source
			
			' *******************
			' Transport Parameter
			' *******************
			
			Set p_Aereopuerto = oCmd.CreateParameter("@Aereopuerto", 3,1,100,Aereopuerto)
			oCmd.Parameters.Append p_Aereopuerto
			
			Set p_Aereolinea = oCmd.CreateParameter("@Aereolinea", 3,1,100,Aereolinea)
			oCmd.Parameters.Append p_Aereolinea
			
			Set p_Need_Transport = oCmd.CreateParameter("@Need_Transport", 3,1,100,Need_Transport)
			oCmd.Parameters.Append p_Need_Transport
			
			Set p_Aprox_Arrival_Time = oCmd.CreateParameter("@Aprox_Arrival_Time", 200,1,100,Aprox_Arrival_Time)
			oCmd.Parameters.Append p_Aprox_Arrival_Time
			
			Set p_Notes = oCmd.CreateParameter("@Notes", 200,1,100,Notes)
			oCmd.Parameters.Append p_Notes
			
			Set p_Pending_info = oCmd.CreateParameter("@Pending_info", 200,1,100,Pending_info)
			oCmd.Parameters.Append p_Pending_info
			
			
			' *******************
			' Visit Calendar
			' *******************
			
			Set p_Propiedad = oCmd.CreateParameter("@Propiedad", 200,1,100,Propiedad)
			oCmd.Parameters.Append p_Propiedad
			
			Set p_Internest = oCmd.CreateParameter("@Internest", 200,1,100,Internest)
			oCmd.Parameters.Append p_Internest
			
			Set p_Give_Aways = oCmd.CreateParameter("@Give_Aways", 200,1,100,Give_Aways)
			oCmd.Parameters.Append p_Give_Aways
			
			Set p_Date = oCmd.CreateParameter("@Fecha", 200,1,100,Fecha)
			oCmd.Parameters.Append p_Date
			
			Set p_Time = oCmd.CreateParameter("@Hora_Time", 200,1,100,Hora_Time)
			oCmd.Parameters.Append p_Time

			
			' ********************
			' Trips Detail
			' **********************
			
			If (Extra_Guests = "") then
				Extra_Guests = 0
			end if
				
			If (Extra_Nights = "") then
				Extra_Nights = 0
			end if	
			If (Kids = "") then
				Kids = 0
			end if
			
			
			
			Set p_Code = oCmd.CreateParameter("@code", 200,1,100,pCode)
			oCmd.Parameters.Append p_Code
			
			Set p_Creator = oCmd.CreateParameter("@Creator", 200,1,100,Creator)
			oCmd.Parameters.Append p_Creator
			
			Set p_Product = oCmd.CreateParameter("@Product", 200,1,100,Product)
			oCmd.Parameters.Append p_Product
			
			Set p_Campaign = oCmd.CreateParameter("@Campaign", 200,1,100,Campaign)
			oCmd.Parameters.Append p_Campaign
			
			Set p_Extra_Guests = oCmd.CreateParameter("@Extra_Guests", 3,1,100,Extra_Guests)
			oCmd.Parameters.Append p_Extra_Guests
			
			Set p_Extra_Nights = oCmd.CreateParameter("@Extra_Nights", 3,1,100,Extra_Nights)
			oCmd.Parameters.Append p_Extra_Nights
			
			Set p_Kids = oCmd.CreateParameter("@Kids", 3,1,100,Kids)
			oCmd.Parameters.Append p_Kids
			
			Set p_Extra_Names = oCmd.CreateParameter("@Extra_Names", 200,1,100,Extra_Names)
			oCmd.Parameters.Append p_Extra_Names
			
			Set p_Room_Details = oCmd.CreateParameter("@Room_Details", 200,1,100,Room_Details)
			oCmd.Parameters.Append p_Room_Details
			
			Set p_Activities = oCmd.CreateParameter("@Activities", 200,1,100,Activities)
			oCmd.Parameters.Append p_Activities
			
			Set p_arrival1 = oCmd.CreateParameter("@arrival1", 200,1,100,arrival1)
			oCmd.Parameters.Append p_arrival1
			
			Set p_departure1 = oCmd.CreateParameter("@departure1", 200,1,100,departure1)
			oCmd.Parameters.Append p_departure1
			
			Set p_arrival2 = oCmd.CreateParameter("@arrival2", 200,1,100,arrival2)
			oCmd.Parameters.Append p_arrival2
			
			Set p_departure2 = oCmd.CreateParameter("@departure2", 200,1,100,departure2)
			oCmd.Parameters.Append p_departure2
			
			' ********************
			' Trips Detail Extra1
			' **********************

			Dim codeId1,creator1,product1,campaign1,arrival11,departure11,arrival21,departure21,totalNumberGuests1,namesOfChaperones1,roomDetail1,actividades1,numberChildren1,travelID1
			
			' temp parameters to check any changed of fechas
			' if temp = 0 => no changed, temp = 1 => fecha 1 changed, temp = 2 => fecha 2 changed, temp = 3 => both of fecha changed
			Dim travel1changed, travel2changed, travel3changed, travel4changed

			IF (Request("travelID_1")= "") Then 
				codeId1 = 0
				creator1 = " "
				product1 = 1
				campaign1 = " "
				
				arrival11 = " "
				departure11 = " "
				arrival21 = " "
				departure21 = " "
				totalNumberGuests1 = 0
				nochesExtra1 = 0
				namesOfChaperones1 = " "
				roomDetail1 = " "
				actividades1 = " "
				numberChildren1 = 0
				travelID1 = " "
			else 
				arrival11 = Request("arrival1_1")
				if (arrival11 = "") then
					arrival11 = ""
				end if
				
				departure11 = Request("departure1_1")
				if (departure11 = "") then
					departure11 = ""
				end if
				
				arrival21 = Request("arrival2_1")
				if (arrival21 = "") then
					arrival21 = ""
				end if
				
				departure21 = Request("departure2_1")
				if (departure21 = "") then
					departure21 = ""
				end if
				
				arrivalOri11 = Request("arrivalOri1_1")
				departureOri11 = Request("departureOri1_1")
				arrivalOri21 = Request("arrivalOri2_1")
				departureOri21 = Request("departureOri2_1")
				
				if ((arrival11 <> arrivalOri11 or departure11 <> departureOri11) and arrival21 = arrivalOri21 and departure21 = departureOri21) then
					travel1changed = 1
				elseif ((arrival11 = arrivalOri11 and departure11 = departureOri11) and (arrival21 <> arrivalOri21 or departure21 <> departureOri21)) then
					travel1changed = 2
				elseif ((arrival11 <> arrivalOri11 or departure11 <> departureOri11) and (arrival21 <> arrivalOri21 or departure21 <> departureOri21)) then
					travel1changed = 3
				else 
					travel1changed = 0
				end if
				
				codeId1 = Request("codeID_1")
				creator1 = Request("Originador_1")
				product1 = Request("Product_1")
				campaign1 = Request("Campaing_1")
				
				nochesExtra1 = Request("Noches_Extras_1")
				totalNumberGuests1 = Request("NumeroTotaldeInvitados_1")
				namesOfChaperones1 = Request("NombresdeAcompanantes_1")
				roomDetail1 = Request("DetallesdeHabitacion_1")
				actividades1 = Request("Actividades_1")
				numberChildren1 = Request("NumerodeNinos_1")
				travelID1 = Request("travelID_1")
			end if
			
			Set codeId_1 = oCmd.CreateParameter("@codeId_1", 3,1,100,codeId1)
			oCmd.Parameters.Append codeId_1
			
			Set creator_1 = oCmd.CreateParameter("@creator_1", 200,1,100,creator1)
			oCmd.Parameters.Append creator_1
			
			Set product_1 = oCmd.CreateParameter("@product_1", 3,1,100,product1)
			oCmd.Parameters.Append product_1
			
			Set campaign_1 = oCmd.CreateParameter("@campaign_1", 200,1,100,campaign1)
			oCmd.Parameters.Append campaign_1
			
			Set arrival1_1 = oCmd.CreateParameter("@arrival1_1", 200,1,100,arrival11)
			oCmd.Parameters.Append arrival1_1
			
			Set departure1_1 = oCmd.CreateParameter("@departure1_1", 200,1,100,departure11)
			oCmd.Parameters.Append departure1_1
			
			Set arrival2_1 = oCmd.CreateParameter("@arrival2_1", 200,1,100,arrival21)
			oCmd.Parameters.Append arrival2_1
			
			Set departure2_1 = oCmd.CreateParameter("@departure2_1", 200,1,100,departure21)
			oCmd.Parameters.Append departure2_1
			
			Set totalNumberGuests_1 = oCmd.CreateParameter("@totalNumberGuests_1", 3,1,100,totalNumberGuests1)
			oCmd.Parameters.Append totalNumberGuests_1
			
			Set NochesExra_1 = oCmd.CreateParameter("@nochesExtra_1", 200,1,100,nochesExtra1)
			oCmd.Parameters.Append NochesExra_1
			
			Set namesOfChaperones_1 = oCmd.CreateParameter("@namesOfChaperones_1", 200,1,100,namesOfChaperones1)
			oCmd.Parameters.Append namesOfChaperones_1

			Set roomDetail_1 = oCmd.CreateParameter("@roomDetail_1", 200,1,100,roomDetail1)
			oCmd.Parameters.Append roomDetail_1
			
			Set actividades_1 = oCmd.CreateParameter("@actividades_1", 200,1,100,actividades1)
			oCmd.Parameters.Append actividades_1
			
			Set numberChildren_1 = oCmd.CreateParameter("@numberChildren_1", 3,1,100,numberChildren1)
			oCmd.Parameters.Append numberChildren_1
			
			Set travelID_1 = oCmd.CreateParameter("@travelID_1", 200,1,100,travelID1)
			oCmd.Parameters.Append travelID_1
			
			Set travelID_1_checkChanged = oCmd.CreateParameter("@travelID_1_checkChanged", 3,1,100,travel1changed)
			oCmd.Parameters.Append travelID_1_checkChanged
			
			' ********************
			' Travels 2
			' **********************
			
			Dim arrival12,departure12,arrival22,departure22,totalNumberGuests2,namesOfChaperones2,roomDetail2,actividades2,numberChildren2,travelID2
			
			IF (Request("travelID_2") = "") Then 
				codeId2 = 0
				creator2 = " "
				product2 = 1
				campaign2 = " "
				arrival12 = " "
				departure12 = " "
				arrival22 = " "
				departure22 = " "
				totalNumberGuests2 = 0
				namesOfChaperones2 = " "
				roomDetail2 = " "
				actividades2 = " "
				numberChildren2 = 0
				travelID2 = " "
				nochesExtra2 = 0
				travel2changed = 0
			else 
				arrival12 = Request("arrival1_2")
				if (arrival12 = "") then
					arrival12 = ""
				end if
				
				departure12 = Request("departure1_2")
				if (departure12 = "") then
					departure12 = ""
				end if
				
				arrival22 = Request("arrival2_2")
				if (arrival22 = "") then
					arrival22 = ""
				end if
				
				departure22 = Request("departure2_2")
				if (departure22 = "") then
					departure22 = ""
				end if
				
				arrivalOri12 = Request("arrivalOri1_2")
				departureOri12 = Request("departureOri1_2")
				arrivalOri22 = Request("arrivalOri2_2")
				departureOri22 = Request("departureOri2_2")
				
				if ((arrival12 <> arrivalOri12 or departure12 <> departureOri12) and arrival22 = arrivalOri22 and departure22 = departureOri22) then
					travel2changed = 1
				elseif ((arrival12 = arrivalOri12 and departure12 = departureOri12) and (arrival22 <> arrivalOri22 or departure22 <> departureOri22)) then
					travel2changed = 2
				elseif ((arrival12 <> arrivalOri12 or departure12 <> departureOri12) and (arrival22 <> arrivalOri22 or departure22 <> departureOri22)) then
					travel2changed = 3
				else 
					travel2changed = 0
				end if
				
				codeId2 = Request("codeID_2")
				creator2 = Request("Originador_2")
				product2 = Request("Product_2")
				campaign2 = Request("Campaing_2")
				
				nochesExtra2 = Request("Noches_Extras_2")
				totalNumberGuests2 = Request("NumeroTotaldeInvitados_2")
				namesOfChaperones2 = Request("NombresdeAcompanantes_2")
				roomDetail2 = Request("DetallesdeHabitacion_2")
				actividades2 = Request("Actividades_2")
				numberChildren2 = Request("NumerodeNinos_2")
				travelID2 = Request("travelID_2")
			end if

			Set codeId_2 = oCmd.CreateParameter("@codeId_2", 3,1,100,codeId2)
			oCmd.Parameters.Append codeId_2
			
			Set creator_2 = oCmd.CreateParameter("@creator_2", 200,1,100,creator2)
			oCmd.Parameters.Append creator_2
			
			Set product_2 = oCmd.CreateParameter("@product_2", 3,1,100,product2)
			oCmd.Parameters.Append product_2
			
			Set campaign_2 = oCmd.CreateParameter("@campaign_2", 200,1,100,campaign2)
			oCmd.Parameters.Append campaign_2
			
			Set arrival1_2 = oCmd.CreateParameter("@arrival1_2", 200,1,100,arrival12)
			oCmd.Parameters.Append arrival1_2
			
			Set departure1_2 = oCmd.CreateParameter("@departure1_2", 200,1,100,departure12)
			oCmd.Parameters.Append departure1_2
			
			Set arrival2_2 = oCmd.CreateParameter("@arrival2_2", 200,1,100,arrival22)
			oCmd.Parameters.Append arrival2_2
			
			Set departure2_2 = oCmd.CreateParameter("@departure2_2", 200,1,100,departure22)
			oCmd.Parameters.Append departure2_2
			
			Set totalNumberGuests_2 = oCmd.CreateParameter("@totalNumberGuests_2", 3,1,100,totalNumberGuests2)
			oCmd.Parameters.Append totalNumberGuests_2
			
			Set NochesExra_2 = oCmd.CreateParameter("@nochesExtra_2", 3,1,100,nochesExtra2)
			oCmd.Parameters.Append NochesExra_2

			Set namesOfChaperones_2 = oCmd.CreateParameter("@namesOfChaperones_2", 200,1,100,namesOfChaperones2)
			oCmd.Parameters.Append namesOfChaperones_2
			
			Set roomDetail_2 = oCmd.CreateParameter("@roomDetail_2", 200,1,100,roomDetail2)
			oCmd.Parameters.Append roomDetail_2
			
			Set actividades_2 = oCmd.CreateParameter("@actividades_2", 200,1,100,actividades2)
			oCmd.Parameters.Append actividades_2
			
			Set numberChildren_2 = oCmd.CreateParameter("@numberChildren_2", 3,1,100,numberChildren2)
			oCmd.Parameters.Append numberChildren_2
			
			Set travelID_2 = oCmd.CreateParameter("@travelID_2", 200,1,100,travelID2)
			oCmd.Parameters.Append travelID_2
			
			Set travelID_2_checkChanged = oCmd.CreateParameter("@travelID_2_checkChanged", 3,1,100,travel2changed)
			oCmd.Parameters.Append travelID_2_checkChanged
			
			
			' ********************
			' Travels 3
			' **********************
			
			Dim arrival13,departure13,arrival23,departure23,totalNumberGuests3,namesOfChaperones3,roomDetail3,actividades3,numberChildren3,travelID3
			
			IF (Request("travelID_3") = "") Then 
				codeId3 = 0
				creator3 = " "
				product3 = 1
				campaign3 = " "
				arrival13 = ""
				departure13 = ""
				arrival23 = ""
				departure23 = ""
				totalNumberGuests3 = 0
				namesOfChaperones3 = ""
				roomDetail3 = ""
				actividades3 = ""
				numberChildren3 = 0
				travelID3 = ""
				nochesExtra3 = 0
				travel3changed = 0
			else 
				arrival13 = Request("arrival1_3")
				if (arrival13 = "") then
					arrival13 = ""
				end if
				
				departure13 = Request("departure1_3")
				if (departure13 = "") then
					departure13 = ""
				end if
				
				arrival23 = Request("arrival2_3")
				if (arrival23 = "") then
					arrival23 = ""
				end if
				
				departure23 = Request("departure2_3")
				if (departure23 = "") then
					departure23 = ""
				end if
				
				codeId3 = Request("codeID_3")
				creator3 = Request("Originador_3")
				product3 = Request("Product_3")
				campaign3 = Request("Campaing_3")
				
				arrivalOri13 = Request("arrivalOri1_3")
				departureOri13 = Request("departureOri1_3")
				arrivalOri23 = Request("arrivalOri2_3")
				departureOri23 = Request("departureOri2_3")
				
				if ((arrival13 <> arrivalOri13 or departure13 <> departureOri13) and arrival23 = arrivalOri23 and departure23 = departureOri23) then
					travel3changed = 1
				elseif ((arrival13 = arrivalOri13 and departure13 = departureOri13) and (arrival23 <> arrivalOri23 or departure23 <> departureOri23)) then
					travel3changed = 2
				elseif ((arrival13 <> arrivalOri13 or departure13 <> departureOri13) and (arrival23 <> arrivalOri23 or departure23 <> departureOri23)) then
					travel3changed = 3
				else 
					travel3changed = 0
				end if
				
				nochesExtra3 = Request("Noches_Extras_3")
				totalNumberGuests3 = Request("NumeroTotaldeInvitados_3")
				namesOfChaperones3 = Request("NombresdeAcompanantes_3")
				roomDetail3 = Request("DetallesdeHabitacion_3")
				actividades3 = Request("Actividades_3")
				numberChildren3= Request("NumerodeNinos_3")
				travelID3 = Request("travelID_3")
			end if
			
			Set codeId_3 = oCmd.CreateParameter("@codeId_3", 3,1,100,codeId3)
			oCmd.Parameters.Append codeId_3
			
			Set creator_3 = oCmd.CreateParameter("@creator_3", 200,1,100,creator3)
			oCmd.Parameters.Append creator_3
			
			Set product_3 = oCmd.CreateParameter("@product_3", 3,1,100,product3)
			oCmd.Parameters.Append product_3
			
			Set campaign_3 = oCmd.CreateParameter("@campaign_3", 200,1,100,campaign3)
			oCmd.Parameters.Append campaign_3
			
			
			Set arrival1_3 = oCmd.CreateParameter("@arrival1_3", 200,1,100,arrival13)
			oCmd.Parameters.Append arrival1_3
			
			Set departure1_3 = oCmd.CreateParameter("@departure1_3", 200,1,100,departure13)
			oCmd.Parameters.Append departure1_3
			
			Set arrival2_3 = oCmd.CreateParameter("@arrival2_3", 200,1,100,arrival23)
			oCmd.Parameters.Append arrival2_3
			
			Set departure2_3 = oCmd.CreateParameter("@departure2_3", 200,1,100,departure23)
			oCmd.Parameters.Append departure2_3
			
			Set totalNumberGuests_3 = oCmd.CreateParameter("@totalNumberGuests_3", 3,1,100,totalNumberGuests3)
			oCmd.Parameters.Append totalNumberGuests_3
			
			Set NochesExra_3 = oCmd.CreateParameter("@nochesExtra_3", 3,1,100,nochesExtra3)
			oCmd.Parameters.Append NochesExra_3
			
			Set namesOfChaperones_3 = oCmd.CreateParameter("@namesOfChaperones_3", 200,1,100,namesOfChaperones3)
			oCmd.Parameters.Append namesOfChaperones_3
			
			Set roomDetail_3 = oCmd.CreateParameter("@roomDetail_3", 200,1,100,roomDetail3)
			oCmd.Parameters.Append roomDetail_3
			
			Set actividades_3 = oCmd.CreateParameter("@actividades_3", 200,1,100,actividades3)
			oCmd.Parameters.Append actividades_3
			
			Set numberChildren_3 = oCmd.CreateParameter("@numberChildren_3", 3,1,100,numberChildren3)
			oCmd.Parameters.Append numberChildren_3
			
			Set travelID_3 = oCmd.CreateParameter("@travelID_3", 200,1,100,travelID3)
			oCmd.Parameters.Append travelID_3
			
			Set travelID_3_checkChanged = oCmd.CreateParameter("@travelID_3_checkChanged", 3,1,100,travel3changed)
			oCmd.Parameters.Append travelID_3_checkChanged
			
			' ********************
			' Travels 4
			' **********************
			
			Dim arrival14,departure14,arrival24,departure24,totalNumberGuests4,namesOfChaperones4,roomDetail4,actividades4,numberChildren4,travelID4
			
			IF (Request("travelID_4") = "") Then 
				codeId4 = 0
				creator4 = " "
				product4 = 0
				campaign4 = " "
				arrival14 = ""
				departure14 = ""
				arrival24 = ""
				departure24 = ""
				totalNumberGuests4 = 0
				namesOfChaperones4 = ""
				roomDetail4 = ""
				actividades4 = ""
				numberChildren4 = 0
				travelID4 = ""
				travel4changed = 0
				nochesExtra4 = 0
			else 
				arrival14 = Request("arrival1_4")
				if (arrival14 = "") then
					arrival14 = ""
				end if
				
				departure14 = Request("departure1_4")
				if (departure14 = "") then
					departure14 = ""
				end if
				
				arrival24 = Request("arrival2_4")
				if (arrival24 = "") then
					arrival24 = ""
				end if
				
				departure24 = Request("departure2_4")
				if (departure24 = "") then
					departure24 = ""
				end if
				
				arrivalOri14 = Request("arrivalOri1_4")
				departureOri14 = Request("departureOri1_4")
				arrivalOri24 = Request("arrivalOri2_4")
				departureOri24 = Request("departureOri2_4")
				
				if ((arrival14 <> arrivalOri14 or departure14 <> departureOri14) and arrival24 = arrivalOri24 and departure24 = departureOri24) then
					travel4changed = 1
				elseif ((arrival14 = arrivalOri14 and departure14 = departureOri14) and (arrival24 <> arrivalOri24 or departure24 <> departureOri24)) then
					travel4changed = 2
				elseif ((arrival14 <> arrivalOri14 or departure14 <> departureOri14) and (arrival24 <> arrivalOri24 or departure24 <> departureOri24)) then
					travel4changed = 3
				else 
					travel4changed = 0
				end if
				
				codeId4 = Request("codeID_4")
				creator4 = Request("Originador_4")
				product4 = Request("Product_4")
				campaign4 = Request("Campaing_4")
				
				totalNumberGuests4 = Request("NumeroTotaldeInvitados_4")
				namesOfChaperones4 = Request("NombresdeAcompanantes_4")
				roomDetail4 = Request("DetallesdeHabitacion_4")
				actividades4 = Request("Actividades_4")
				nochesExtra4 = Request("Noches_Extras_4")
				numberChildren4= Request("NumerodeNinos_4")
				travelID4 = Request("travelID_4")
				
			end if
			
			Set codeId_4 = oCmd.CreateParameter("@codeId_4", 3,1,100,codeId4)
			oCmd.Parameters.Append codeId_4
			
			Set creator_4 = oCmd.CreateParameter("@creator_4", 200,1,100,creator4)
			oCmd.Parameters.Append creator_4
			
			Set product_4 = oCmd.CreateParameter("@product_4", 3,1,100,product4)
			oCmd.Parameters.Append product_4
			
			Set campaign_4 = oCmd.CreateParameter("@campaign_4", 200,1,100,campaign4)
			oCmd.Parameters.Append campaign_4
			
			Set arrival1_4 = oCmd.CreateParameter("@arrival1_4", 200,1,100,arrival14)
			oCmd.Parameters.Append arrival1_4
			
			Set departure1_4 = oCmd.CreateParameter("@departure1_4", 200,1,100,departure14)
			oCmd.Parameters.Append departure1_4
			
			Set arrival2_4= oCmd.CreateParameter("@arrival2_4", 200,1,100,arrival24)
			oCmd.Parameters.Append arrival2_4
			
			Set departure2_4 = oCmd.CreateParameter("@departure2_4", 200,1,100,departure24)
			oCmd.Parameters.Append departure2_4
			
			Set totalNumberGuests_4 = oCmd.CreateParameter("@totalNumberGuests_4", 3,1,100,totalNumberGuests4)
			oCmd.Parameters.Append totalNumberGuests_4
			
			Set NochesExra_4 = oCmd.CreateParameter("@nochesExtra_4", 3,1,100,nochesExtra4)
			oCmd.Parameters.Append NochesExra_4
			
			Set namesOfChaperones_4 = oCmd.CreateParameter("@namesOfChaperones_4", 200,1,100,namesOfChaperones4)
			oCmd.Parameters.Append namesOfChaperones_4
			
			Set roomDetail_4 = oCmd.CreateParameter("@roomDetail_4", 200,1,100,roomDetail4)
			oCmd.Parameters.Append roomDetail_4
			
			Set actividades_4 = oCmd.CreateParameter("@actividades_4", 200,1,100,actividades4)
			oCmd.Parameters.Append actividades_4
			
			Set numberChildren_4 = oCmd.CreateParameter("@numberChildren_4", 3,1,100,numberChildren4)
			oCmd.Parameters.Append numberChildren_4
			
			Set travelID_4 = oCmd.CreateParameter("@travelID_4", 200,1,100,travelID4)
			oCmd.Parameters.Append travelID_4
			
			Set travelID_4_checkChanged = oCmd.CreateParameter("@travelID_4_checkChanged", 3,1,100,travel4changed)
			oCmd.Parameters.Append travelID_4_checkChanged
			
			' ********************
			' CreditCards
			' **********************
			Set NombreCard = oCmd.CreateParameter("@NombreCard", 200,1,100,encryptNombreCard)
			oCmd.Parameters.Append NombreCard
			
			Set Tipo = oCmd.CreateParameter("@Tipo", 200,1,100,encryptTipo)
			oCmd.Parameters.Append Tipo
			
			Set NumerodeTarjetaCard = oCmd.CreateParameter("@NumerodeTarjetaCard", 200,1,100,encryptNumerodeTarjetaCard)
			oCmd.Parameters.Append NumerodeTarjetaCard
			
			Set Address1_billing = oCmd.CreateParameter("@Address1_billing", 200,1,100,Request("Direccion1_billing"))
			oCmd.Parameters.Append Address1_billing
			
			Set Address2_billing = oCmd.CreateParameter("@Address2_billing", 200,1,100,Request("Direccion2_billing"))
			oCmd.Parameters.Append Address2_billing
			
			Set City_billing = oCmd.CreateParameter("@City_billing", 200,1,100,Request("Ciudad_billing"))
			oCmd.Parameters.Append City_billing
			
			Set Country_billing = oCmd.CreateParameter("@Country_billing", 200,1,100,Request("Pais_billing"))
			oCmd.Parameters.Append Country_billing
			
			Set ZipCode_billing = oCmd.CreateParameter("@ZipCode_billing", 200,1,100,Request("Postal_billing"))
			oCmd.Parameters.Append ZipCode_billing
			
			Set Province_billing = oCmd.CreateParameter("@Province_billing", 200,1,100,Request("Stado_billing"))
			oCmd.Parameters.Append Province_billing
			
			Set FechaDeExpiracion = oCmd.CreateParameter("@FechaDeExpiracion", 200,1,100,Request("FechaDeExpiracion"))
			oCmd.Parameters.Append FechaDeExpiracion
			
			Set CodigodeSeguridad = oCmd.CreateParameter("@CodigodeSeguridad", 200,1,100,encryptCodigodeSeguridad)
			oCmd.Parameters.Append CodigodeSeguridad
			
			Set p_Assign = oCmd.CreateParameter("@assign", 3,1,100,Assign)
			oCmd.Parameters.Append p_Assign
			
			Set userId = oCmd.CreateParameter("@userId", 3,1,100,session("SalesId"))
			oCmd.Parameters.Append userId
			
			Set prospectId = oCmd.CreateParameter("@prospectId", 3,1,100,Request("prospectID"))
			oCmd.Parameters.Append prospectId
			
			if (Request("Marital") <> "" ) then
				p_marital = Request("Marital")
			else 
				p_marital = ""
			end if
			
			if (Request("boat") <> "" ) then
				p_boat = Request("boat")
			else 
				p_boat = ""
			end if
			
			if (Request("feet") <> "" ) then
				p_feet = Request("feet")
			else 
				p_feet = ""
			end if
			
			if (Request("golf") <> "" ) then
				p_golf = Request("golf")
			else 
				p_golf = ""
			end if
			
			if (Request("investment_Range") <> "" ) then
				p_investment_Range = Request("investment_Range")
			else 
				p_investment_Range = ""
			end if
			
			if (Request("Occupation") <> "" ) then
				p_Occupation = Request("Occupation")
			else 
				p_Occupation = ""
			end if
			
			if (Request("kindOfInvestment") <> "" ) then
				p_kindOfInvestment = Request("kindOfInvestment")
			else 
				p_kindOfInvestment = ""
			end if
			
			if (Request("Annual_Income") <> "" ) then
				p_Annual_Income = Request("Annual_Income")
			else 
				p_Annual_Income = ""
			end if
			
			' *************************************'
			Set Marital = oCmd.CreateParameter("@MaritalStatus", 200,1,100,p_marital)
			oCmd.Parameters.Append Marital
			
			Set OwnABoat = oCmd.CreateParameter("@OwnABoat", 200,1,100,p_boat)
			oCmd.Parameters.Append OwnABoat
			
			Set Feet = oCmd.CreateParameter("@Feet", 200,1,100,p_feet)
			oCmd.Parameters.Append Feet
			
			Set PlayGolf = oCmd.CreateParameter("@PlayGolf", 200,1,100,p_golf)
			oCmd.Parameters.Append PlayGolf
			
			Set InvestmentRange = oCmd.CreateParameter("@InvestmentRange", 200,1,100,p_investment_Range)
			oCmd.Parameters.Append InvestmentRange
			
			Set Occupation = oCmd.CreateParameter("@Occupation", 200,1,100,p_Occupation)
			oCmd.Parameters.Append Occupation
			
			Set KindOfInvestment = oCmd.CreateParameter("@KindOfInvestment", 200,1,100,p_kindOfInvestment)
			oCmd.Parameters.Append KindOfInvestment
			
			Set AnnualIncome = oCmd.CreateParameter("@AnnualIncome", 200,1,100,p_Annual_Income)
			oCmd.Parameters.Append AnnualIncome
			
			' ********************
			' End CreditCards
			' **********************
			
		set rss = oCmd.execute
		
		
		' ==========================================================================
		
			' *******************************************
			' Area add new travel for guest
			'**********************************************
		
		' ==========================================================================
	
		Set oCmd1 = Server.CreateObject("ADODB.Command")
		  
		    oCmd1.ActiveConnection = objConnect
			oCmd1.CommandText = "sp_add_new_Travel_InProspectProfile" 
			oCmd1.CommandType = 4
			
		
		' ********************
			' Trips Detail Extra1
			' **********************
			
			pCodeExtra = "PSP"&Year(DATE())
			
			Set p_Code_Extra1 = oCmd1.CreateParameter("@code_Extra1", 200,1,100,pCodeExtra)
			oCmd1.Parameters.Append p_Code_Extra1
			
			Set p_Creator_Extra1 = oCmd1.CreateParameter("@Creator_Extra1", 200,1,100,Creator_Extra1)
			oCmd1.Parameters.Append p_Creator_Extra1
			
			Set p_Product_Extra1 = oCmd1.CreateParameter("@Product_Extra1", 200,1,100,Product_Extra1)
			oCmd1.Parameters.Append p_Product_Extra1
			
			Set p_Campaign_Extra1 = oCmd1.CreateParameter("@Campaign_Extra1", 200,1,100,Campaign_Extra1)
			oCmd1.Parameters.Append p_Campaign_Extra1
			
			Set p_Extra_Guests_Extra1 = oCmd1.CreateParameter("@Extra_Guests_Extra1", 3,1,100,Extra_Guests_Extra1)
			oCmd1.Parameters.Append p_Extra_Guests_Extra1
			
			Set p_Extra_Nights_Extra1 = oCmd1.CreateParameter("@Extra_Nights_Extra1", 3,1,100,Extra_Nights_Extra1)
			oCmd1.Parameters.Append p_Extra_Nights_Extra1
			
			Set p_Kids_Extra1 = oCmd1.CreateParameter("@Kids_Extra1", 3,1,100,Kids_Extra1)
			oCmd1.Parameters.Append p_Kids_Extra1
			
			Set p_Extra_Names_Extra1 = oCmd1.CreateParameter("@Extra_Names_Extra1", 200,1,100,Extra_Names_Extra1)
			oCmd1.Parameters.Append p_Extra_Names_Extra1
			
			Set p_Room_Details_Extra1 = oCmd1.CreateParameter("@Room_Details_Extra1", 200,1,100,Room_Details_Extra1)
			oCmd1.Parameters.Append p_Room_Details_Extra1
			
			Set p_Activities_Extra1 = oCmd1.CreateParameter("@Activities_Extra1", 200,1,100,Activities_Extra1)
			oCmd1.Parameters.Append p_Activities_Extra1
			
			Set p_arrival1_Extra1 = oCmd1.CreateParameter("@arrival1_Extra1", 200,1,100,arrival1_Extra1)
			oCmd1.Parameters.Append p_arrival1_Extra1
			
			Set p_departure1_Extra1 = oCmd1.CreateParameter("@departure1_Extra1", 200,1,100,departure1_Extra1)
			oCmd1.Parameters.Append p_departure1_Extra1
			
			Set p_arrival2_Extra1 = oCmd1.CreateParameter("@arrival2_Extra1", 200,1,100,arrival2_Extra1)
			oCmd1.Parameters.Append p_arrival2_Extra1
			
			Set p_departure2_Extra1 = oCmd1.CreateParameter("@departure2_Extra1", 200,1,100,departure2_Extra1)
			oCmd1.Parameters.Append p_departure2_Extra1
			
			' ********************
			' Trips Detail Extra2
			' **********************
			Set p_Code_Extra2 = oCmd1.CreateParameter("@code_Extra2", 200,1,100,pCodeExtra)
			oCmd1.Parameters.Append p_Code_Extra2
			
			Set p_Creator_Extra2 = oCmd1.CreateParameter("@Creator_Extra2", 200,1,100,Creator_Extra2)
			oCmd1.Parameters.Append p_Creator_Extra2
			
			Set p_Product_Extra2 = oCmd1.CreateParameter("@Product_Extra2", 200,1,100,Product_Extra2)
			oCmd1.Parameters.Append p_Product_Extra2
			
			Set p_Campaign_Extra2 = oCmd1.CreateParameter("@Campaign_Extra2", 200,1,100,Campaign_Extra2)
			oCmd1.Parameters.Append p_Campaign_Extra2
			
			Set p_Extra_Guests_Extra2 = oCmd1.CreateParameter("@Extra_Guests_Extra2", 3,1,100,Extra_Guests_Extra2)
			oCmd1.Parameters.Append p_Extra_Guests_Extra2
			
			Set p_Extra_Nights_Extra2 = oCmd1.CreateParameter("@Extra_Nights_Extra2", 3,1,100,Extra_Nights_Extra2)
			oCmd1.Parameters.Append p_Extra_Nights_Extra2
			
			Set p_Kids_Extra2 = oCmd1.CreateParameter("@Kids_Extra2", 3,1,100,Kids_Extra2)
			oCmd1.Parameters.Append p_Kids_Extra2
			
			Set p_Extra_Names_Extra2 = oCmd1.CreateParameter("@Extra_Names_Extra2", 200,1,100,Extra_Names_Extra2)
			oCmd1.Parameters.Append p_Extra_Names_Extra2
			
			Set p_Room_Details_Extra2 = oCmd1.CreateParameter("@Room_Details_Extra2", 200,1,100,Room_Details_Extra2)
			oCmd1.Parameters.Append p_Room_Details_Extra2
			
			Set p_Activities_Extra2 = oCmd1.CreateParameter("@Activities_Extra2", 200,1,100,Activities_Extra2)
			oCmd1.Parameters.Append p_Activities_Extra2
			
			Set p_arrival1_Extra2 = oCmd1.CreateParameter("@arrival1_Extra2", 200,1,100,arrival1_Extra2)
			oCmd1.Parameters.Append p_arrival1_Extra2
			
			Set p_departure1_Extra2 = oCmd1.CreateParameter("@departure1_Extra2", 200,1,100,departure1_Extra2)
			oCmd1.Parameters.Append p_departure1_Extra2
			
			Set p_arrival2_Extra2 = oCmd1.CreateParameter("@arrival2_Extra2", 200,1,100,arrival2_Extra2)
			oCmd1.Parameters.Append p_arrival2_Extra2
			
			Set p_departure2_Extra2 = oCmd1.CreateParameter("@departure2_Extra2", 200,1,100,departure2_Extra2)
			oCmd1.Parameters.Append p_departure2_Extra2
			
			' ********************
			' Trips Detail Extra 3
			' **********************
			
			Set p_Code_Extra3 = oCmd1.CreateParameter("@code_Extra3", 200,1,100,pCodeExtra)
			oCmd1.Parameters.Append p_Code_Extra3
			
			Set p_Creator_Extra3 = oCmd1.CreateParameter("@Creator_Extra3", 200,1,100,Creator_Extra3)
			oCmd1.Parameters.Append p_Creator_Extra3
			
			Set p_Product_Extra3 = oCmd1.CreateParameter("@Product_Extra3", 200,1,100,Product_Extra3)
			oCmd1.Parameters.Append p_Product_Extra3
			
			Set p_Campaign_Extra3 = oCmd1.CreateParameter("@Campaign_Extra3", 200,1,100,Campaign_Extra3)
			oCmd1.Parameters.Append p_Campaign_Extra3
			
			Set p_Extra_Guests_Extra3 = oCmd1.CreateParameter("@Extra_Guests_Extra3", 3,1,100,Extra_Guests_Extra3)
			oCmd1.Parameters.Append p_Extra_Guests_Extra3
			
			Set p_Extra_Nights_Extra3 = oCmd1.CreateParameter("@Extra_Nights_Extra3", 3,1,100,Extra_Nights_Extra3)
			oCmd1.Parameters.Append p_Extra_Nights_Extra3
			
			Set p_Kids_Extra3 = oCmd1.CreateParameter("@Kids_Extra3", 3,1,100,Kids_Extra3)
			oCmd1.Parameters.Append p_Kids_Extra3
			
			Set p_Extra_Names_Extra3 = oCmd1.CreateParameter("@Extra_Names_Extra3", 200,1,100,Extra_Names_Extra3)
			oCmd1.Parameters.Append p_Extra_Names_Extra3
			
			Set p_Room_Details_Extra3 = oCmd1.CreateParameter("@Room_Details_Extra3", 200,1,100,Room_Details_Extra3)
			oCmd1.Parameters.Append p_Room_Details_Extra3
			
			Set p_Activities_Extra3 = oCmd1.CreateParameter("@Activities_Extra3", 200,1,100,Activities_Extra3)
			oCmd1.Parameters.Append p_Activities_Extra3
			
			Set p_arrival1_Extra3 = oCmd1.CreateParameter("@arrival1_Extra3", 200,1,100,arrival1_Extra3)
			oCmd1.Parameters.Append p_arrival1_Extra3
			
			Set p_departure1_Extra3 = oCmd1.CreateParameter("@departure1_Extra3", 200,1,100,departure1_Extra3)
			oCmd1.Parameters.Append p_departure1_Extra3
			
			Set p_arrival2_Extra3 = oCmd1.CreateParameter("@arrival2_Extra3", 200,1,100,arrival2_Extra3)
			oCmd1.Parameters.Append p_arrival2_Extra3
			
			Set p_departure2_Extra3 = oCmd1.CreateParameter("@departure2_Extra3", 200,1,100,departure2_Extra3)
			oCmd1.Parameters.Append p_departure2_Extra3
			
			
			Set add_prospectId = oCmd1.CreateParameter("@GuestID", 3,1,100,Request("prospectID"))
			oCmd1.Parameters.Append add_prospectId
		
		
		set rss1 = oCmd1.execute
	
	Response.Redirect("sales-dashboard.asp")

%>